import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:schedule_self_client/state_management/providers/login_status.dart';
import 'package:schedule_self_client/ui/pages/app_layout.dart';
import 'package:schedule_self_client/ui/pages/login_page.dart';

class SplashPage extends StatefulWidget {
  const SplashPage({super.key});

  @override
  State<SplashPage> createState() => _SplashPageState();
}

class _SplashPageState extends State<SplashPage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Consumer<LoginInfo>(builder: (context, loginInfo, child) {
        if (loginInfo.userInfo?.token?.isNotEmpty ?? false) {
          return const AppLayout();
        }
        return const LoginPage();
      }),
    );
  }
}
